package com.etc.serviceimpl;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.etc.dao.UsersDao;
import com.etc.entity.LayuiDate;
import com.etc.entity.Save;
import com.etc.entity.Users;
import com.etc.entity.Videos;
import com.etc.service.UsersService;
@Service
public class UsersServiceImpl implements UsersService {

	@Autowired
	private UsersDao usersdao;
	@Override
	public boolean addUsers(Users users) {
		// TODO Auto-generated method stub
		return usersdao.addUsers(users)>0;
	}

	@Override
	public boolean updateUsers(Users users) {
		// TODO Auto-generated method stub
		return usersdao.updateUsers(users);
	}

	@Override
	public boolean deleteUsers(int userid) {
		// TODO Auto-generated method stub
		return usersdao.deleteUsers(userid)>0;
	}

	@Override
	public Users selectLogin(String userName,String userPwd) {
		// TODO Auto-generated method stub
		return usersdao.selectLogin(userName,userPwd);
	}
	@Override
	public List<Users> selectUsers() {
		// TODO Auto-generated method stub
		return usersdao.selectUsers();
	}

	@Override
	public List<Users> selectUsersByPage(int start, int limit, String keywords) {
		// TODO Auto-generated method stub
		return usersdao.selectUsersByPage(start, limit, keywords);
	}

	@Override
	public List<Users> queryUserCount(String keywords) {
		// TODO Auto-generated method stub
		return usersdao.queryUserCount(keywords);
	}

	@Override
	public LayuiDate<Users> selectUsersByPageLike(int start, int limit, String keywords) {
		// TODO Auto-generated method stub
		int page = (start - 1) * limit;
		List<Users> count = usersdao.queryUserCount(keywords);
		System.out.println(keywords);
		List<Users> list = usersdao.selectUsersByPage(page, limit, keywords);
		LayuiDate<Users> layuiDate = new LayuiDate<Users>(0, "", count.size(), list);
		return layuiDate;
	}
	public List<Users> selectpwd(String userPwd) {
		// TODO Auto-generated method stub
		return usersdao.selectpwd(userPwd);
	}

	@Override
	public boolean updatePwd(Users users) {
		// TODO Auto-generated method stub
		return usersdao.updatePwd(users);
	}

	@Override
	public List<Users> selectUser(String userName) {
		// TODO Auto-generated method stub
		return usersdao.selectUser(userName);
	}

	@Override
	public List<Save> selectUserSave(String userName) {
		// TODO Auto-generated method stub
		return usersdao.selectUserSave(userName);
	}

	@Override
	public boolean updateUsersVip(Users users) {
		// TODO Auto-generated method stub
		return usersdao.updateUsersVip(users);
	}

	


	
	
	
}
